#ifndef IDECODER_H_
#define IDECODER_H_

#define VIDEODECODER_API extern "C"
#define HANDLE void*

namespace video_decoder
{
	typedef struct{
		int width;
		int height;
		unsigned long long timeStamp;
		int type;
		int frameRate;
		int frameNum;
	}FRAME_INFORMATION;

	typedef void (*DecodeCB)(char* pBuf, int size, FRAME_INFORMATION* pFrameInfo, void* pUser); 

	//#define VideoDecoder void*

	VIDEODECODER_API HANDLE PlayPSFile(const char* filename);
	VIDEODECODER_API HANDLE PlayDHFile(const char* filename);
	VIDEODECODER_API HANDLE PlayHKFile(const char* filename);
	VIDEODECODER_API HANDLE PlayNormalFile(const char* filename);

	VIDEODECODER_API HANDLE SaveRTPStream(int port, const char* filename);
	VIDEODECODER_API HANDLE PlayPSStream(int port);
	VIDEODECODER_API HANDLE PlayESStream(int port);
	VIDEODECODER_API HANDLE PlayDHStream(int port);
	VIDEODECODER_API HANDLE PlayHKStream(int port);
	VIDEODECODER_API HANDLE PlayDHRTSPStream(const char* RTSPAddress);
	VIDEODECODER_API HANDLE SaveDHRTSPStream(const char* RTSPAddress, const char* filename);
	VIDEODECODER_API HANDLE PlayCamyuStream(const char* ip);
	VIDEODECODER_API bool SetDecodeCallBack(HANDLE handle, DecodeCB DecodeCBFun, void* pUser);
	VIDEODECODER_API int GetPort(const char* ip);
	VIDEODECODER_API char* GetDescription(HANDLE handle);
	VIDEODECODER_API bool Release(HANDLE handle);

	// return received or read bytes
	VIDEODECODER_API int GetProgress(HANDLE handle);

	VIDEODECODER_API bool Pause(HANDLE handle);
	VIDEODECODER_API bool Play(HANDLE handle);
	VIDEODECODER_API bool Stop(HANDLE handle);
	VIDEODECODER_API bool SnapShot(HANDLE handle, char* filename);
	VIDEODECODER_API bool Seek(HANDLE handle, int timestamp);

	// not implement
	VIDEODECODER_API bool SetRate(HANDLE handle, double rate);
	VIDEODECODER_API HANDLE PlayHKFile(const char* filename);

}


#endif
